package com.wbr.springboot.sbproject.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Random;

@Controller
@RequestMapping("/count")
public class CountController {
    private final Logger log = LoggerFactory.getLogger(CountController.class);
    private final static int CodeLength = 6;

    @RequestMapping("getRandomCount")
    @ResponseBody
    public String getCount(){
        String str = "";
        Random random = new Random();
        for(int i = 0; i < CodeLength; i++){
            str += random.nextInt(10);
        }
        log.info("---------------send code------------------");
        return str;
    }
}
